From 504e6b5eae079a93ac47fe2f1a228db6ff9b1aca Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 25 Jul 2007 09:51:14 +0100 Subject: [PATCH] xenstored: Fix socket-based connection teardown. Reading zero bytes *should* in fact cause the connection to be destroyed. Fix this with a little extra code in the readfd() handler. Signed-off-by: Keir Fraser --- tools/xenstore/xenstored_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 1081103459..f34a698cb4 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1368,6 +1368,12 @@ static int readfd(struct connection *conn, void *data, unsigned int len) break; } + /* Reading zero length means we're done with this connection. */ + if ((rc == 0) && (len != 0)) { + errno = EBADF; + rc = -1; + } + return rc; } -- 2.30.2